home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class TEST_INTEGER1
-
- creation {ANY}
- make
-
- feature {ANY}
-
- make is
- local
- i: INTEGER;
- do
- is_true(1 = 1);
- is_true(0 = 0);
- is_true(-1 = -1);
- is_true(0 + 1 = 1);
- is_true(1 = 1 + 0);
- is_true(0 - 1 = -1);
- is_true(-1 = - 1 + 0);
-
- is_true(2 + 2 = 4);
- is_true(2 + 2 /= 3);
- is_true(2 * 2 = 4);
- is_true(4 = 2 * 2);
-
- i := 76;
- is_true(76 = i);
- is_true(i + 1 = 77);
- is_true(76 = i);
-
- -- is_true(9 / 2 = 4);
- is_true(9 \\ 2 = 1);
-
- is_true(2 ^ 0 = 1);
- is_true(2 ^ 1 = 2);
- is_true(2 ^ 2 = 4);
- is_true(2 ^ 3 = 8);
-
- is_true(3 ^ 0 = 1);
- is_true(3 ^ 1 = 3);
- is_true(3 ^ 2 = 9);
- is_true(3 ^ 3 = 27);
-
- is_true(-3 < -1);
- is_true(-1 < 0);
- is_true(-1 < 1);
- is_true(0 < 1);
- is_true(1 < 2);
-
- is_true(-3 <= -1);
- is_true(-3 <= -3);
- is_true(-1 <= 0);
- is_true(-1 <= 1);
- is_true(-1 <= -1);
- is_true(0 <= 1);
- is_true(1 <= 2);
- is_true(2 <= 2);
-
- is_true(not (3 <= 2));
-
- is_true(3 = +3);
- is_true(+3 = +(1 + 2));
-
- is_true(-3 = 3-6);
-
- is_true(("0").is_equal((0).to_string));
- is_true(("25").is_equal((25).to_string));
- is_true(("-25").is_equal((-25).to_string));
-
- is_true((" 25").is_equal((25).to_string_format(3)));
- is_true((" -25").is_equal((-25).to_string_format(4)));
-
- is_true('0' = (0).digit);
- is_true('5' = (5).digit);
- is_true('9' = (9).digit);
-
- is_true(' ' = (32).to_character);
-
- is_true((-25).abs = 25);
- is_true((25).abs = 25);
-
- is_true((3).max(4) = 4);
- is_true((4).max(3) = 4);
-
- is_true((3).min(4) = 3);
- is_true((4).min(3) = 3);
-
- is_true((-2).min(2) = -2);
- is_true((2).max(-2) = 2);
-
- is_true((0).to_octal = 0);
- is_true((7).to_octal = 7);
- is_true((8).to_octal = 10);
- is_true((9).to_octal = 11);
- is_true((-10).to_octal = -12);
- is_true(400 = (256).to_octal);
- is_true(-400 = (-256).to_octal);
- is_true(377 = (255).to_octal);
- is_true(177 = (127).to_octal);
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_INTEGER1: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- -- std_output.put_string("Yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- TEST_INTEGER1
-